<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>编辑现存主要健康问题从表</title>
	<#include "/common/resource.ftl">
	<script type="text/javascript">
		$(function () {
			<#if (params.healthId)??>
				$.ajaxRequest({
					url: '${params.contextPath}/web/elderHealthQuestion/query.json',
					data: {elderHealthId: "${params.healthId}"},
					success: function (data) {
						if (!data.success) {
							$.message(data.message);
							return;
						}
						var record = data.data;
						for (var key in record) {
						    if (key == 'cerebrovascularDiseaseStatus') {
                                var cerebrovascularDiseaseStatus = record.cerebrovascularDiseaseStatus;
                                var cerebrovascularDiseaseStatusArray = cerebrovascularDiseaseStatus.split(",");
                                var cerebrovascularDiseaseStatusAll = $("input[name='cerebrovascularDiseaseStatus']");
                                for(var i=0; i<cerebrovascularDiseaseStatusArray.length; i++){
                                    
                                    //获取所有复选框对象的value属性，然后，symptomArray[i]和他们匹配，如果有，则说明他应被选中
                                    $.each(cerebrovascularDiseaseStatusAll,function(j,checkbox){
                                        //获取复选框的value属性
                                        var checkValue = $(checkbox).val();
                                        if(cerebrovascularDiseaseStatusArray[i] == checkValue){
                                            $(checkbox).attr("checked",true);
                                            $(checkbox).next().addClass('layui-form-checked');
                                        }
                                    });
                                }
                            } else if (key == 'kidneyDiseaseStatus') {
                                var kidneyDiseaseStatus = record.kidneyDiseaseStatus;
                                var kidneyDiseaseStatusArray = kidneyDiseaseStatus.split(",");
                                var kidneyDiseaseStatusAll = $("input[name='kidneyDiseaseStatus']");
                                for(var i=0; i<kidneyDiseaseStatusArray.length; i++){
                                    
                                    //获取所有复选框对象的value属性，然后，symptomArray[i]和他们匹配，如果有，则说明他应被选中
                                    $.each(kidneyDiseaseStatusAll,function(j,checkbox){
                                        //获取复选框的value属性
                                        var checkValue = $(checkbox).val();
                                        if(kidneyDiseaseStatusArray[i] == checkValue){
                                            $(checkbox).attr("checked",true);
                                            $(checkbox).next().addClass('layui-form-checked');
                                        }
                                    });
                                }
                            } else if (key == 'heartDiseaseStatus') {
                                var heartDiseaseStatus = record.heartDiseaseStatus;
                                var heartDiseaseStatusArray = heartDiseaseStatus.split(",");
                                var heartDiseaseStatusAll = $("input[name='heartDiseaseStatus']");
                                for(var i=0; i<heartDiseaseStatusArray.length; i++){
                                    
                                    //获取所有复选框对象的value属性，然后，symptomArray[i]和他们匹配，如果有，则说明他应被选中
                                    $.each(heartDiseaseStatusAll,function(j,checkbox){
                                        //获取复选框的value属性
                                        var checkValue = $(checkbox).val();
                                        if(heartDiseaseStatusArray[i] == checkValue){
                                            $(checkbox).attr("checked",true);
                                            $(checkbox).next().addClass('layui-form-checked');
                                        }
                                    });
                                }
                            } else if (key == 'angiopathyStatus') {
                                var angiopathyStatus = record.angiopathyStatus;
                                var angiopathyStatusArray = angiopathyStatus.split(",");
                                var angiopathyStatusAll = $("input[name='angiopathyStatus']");
                                for(var i=0; i<angiopathyStatusArray.length; i++){
                                    
                                    //获取所有复选框对象的value属性，然后，symptomArray[i]和他们匹配，如果有，则说明他应被选中
                                    $.each(angiopathyStatusAll,function(j,checkbox){
                                        //获取复选框的value属性
                                        var checkValue = $(checkbox).val();
                                        if(angiopathyStatusArray[i] == checkValue){
                                            $(checkbox).attr("checked",true);
                                            $(checkbox).next().addClass('layui-form-checked');
                                        }
                                    });
                                }
                            } else if (key == 'eyeDiseaseStatus') {
                                var eyeDiseaseStatus = record.eyeDiseaseStatus;
                                var eyeDiseaseStatusArray = eyeDiseaseStatus.split(",");
                                var eyeDiseaseStatusAll = $("input[name='eyeDiseaseStatus']");
                                for(var i=0; i<eyeDiseaseStatusArray.length; i++){
                                    //获取所有复选框对象的value属性，然后，symptomArray[i]和他们匹配，如果有，则说明他应被选中
                                    $.each(eyeDiseaseStatusAll,function(j,checkbox){
                                        //获取复选框的value属性
                                        var checkValue = $(checkbox).val();
                                        if(eyeDiseaseStatusArray[i] == checkValue){
                                            $(checkbox).attr("checked",true);
                                            $(checkbox).next().addClass('layui-form-checked');
                                        }
                                    });
                                }
                            } else if (key == 'nervousDiseaseStatus') {
                                var nervousDiseaseStatus = record.nervousDiseaseStatus;
                                $("select[name='nervousDiseaseStatus']").val(nervousDiseaseStatus);
                            } else if (key == 'otherDiseaseStatus') {
                                var otherDiseaseStatus = record.otherDiseaseStatus;
                                $("select[name='otherDiseaseStatus']").val(otherDiseaseStatus);
                            } else {
                                $("[name='" + key + "']").val(record[key]);
                            }

						}
                        var form = layui.form;
                        form.render();
					}
				});
			</#if>
		});
	</script>
    <link rel="stylesheet" href="${params.contextPath}/static/plug/layui/css/layui.css">
    <style>
        .layui-form select {display:none !important;}
    </style>
</head>
<body>
	<div class="ui-form">
        <#if (params.healthId)??>
		<form class="layui-form ajax-form" action="${params.contextPath}/web/elderHealthQuestion/<#if (params.id)??>modify<#else>save</#if>.json" method="post">
			<input type="hidden" name="elderHealthId" value="${params.healthId}" />
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-row">
                        <div class="layui-col-md9">
                            <div class="layui-form-item">
                                <label class="layui-form-label">脑血管疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="未发现" title="未发现">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="缺血性卒中" title="缺血性卒中">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="脑出血" title="脑出血">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="蛛网膜下腔出血" title="蛛网膜下腔出血">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="短暂性脑缺血发作" title="短暂性脑缺血发作">
                                    <input type="checkbox" name="cerebrovascularDiseaseStatus" value="其他" title="其他">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他脑血管疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="cerebrovascularDiseaseStatusOrher" placeholder="请输入其他脑血管疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md9">
                            <div class="layui-form-item">
                                <label class="layui-form-label">肾脏疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="未发现" title="未发现">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="糖尿病肾病" title="糖尿病肾病">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="肾功能衰竭" title="肾功能衰竭">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="急性肾炎" title="急性肾炎">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="慢性肾炎" title="慢性肾炎">
                                    <input type="checkbox" name="kidneyDiseaseStatus" value="其他" title="其他">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他肾脏疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="kidneyDiseaseStatusOther" placeholder="请输入其他肾脏疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md9">
                            <div class="layui-form-item">
                                <label class="layui-form-label">心脏疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="heartDiseaseStatus" value="未发现" title="未发现">
                                    <input type="checkbox" name="heartDiseaseStatus" value="心肌梗死" title="心肌梗死">
                                    <input type="checkbox" name="heartDiseaseStatus" value="心绞痛" title="心绞痛">
                                    <input type="checkbox" name="heartDiseaseStatus" value="冠状动脉血运重建" title="冠状动脉血运重建">
                                    <input type="checkbox" name="heartDiseaseStatus" value="充血性心力衰竭" title="充血性心力衰竭">
                                    <input type="checkbox" name="heartDiseaseStatus" value="心前区疼痛" title="心前区疼痛">
                                    <input type="checkbox" name="heartDiseaseStatus" value="其他" title="其他">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他心脏疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="heartDiseaseStatusOther" placeholder="请输入其他心脏疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md9">
                            <div class="layui-form-item">
                                <label class="layui-form-label">血管疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="angiopathyStatus" value="未发现" title="未发现">
                                    <input type="checkbox" name="angiopathyStatus" value="夹层动脉瘤" title="夹层动脉瘤">
                                    <input type="checkbox" name="angiopathyStatus" value="动脉闭塞性疾病" title="动脉闭塞性疾病">
                                    <input type="checkbox" name="angiopathyStatus" value="其他" title="其他">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他血管疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="angiopathyStatusOther" placeholder="请输入其他血管疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md9">
                            <div class="layui-form-item">
                                <label class="layui-form-label">眼部疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="eyeDiseaseStatus" value="未发现" title="未发现">
                                    <input type="checkbox" name="eyeDiseaseStatus" value="视网膜出血或渗出" title="视网膜出血或渗出">
                                    <input type="checkbox" name="eyeDiseaseStatus" value="视乳头水肿" title="视乳头水肿">
                                    <input type="checkbox" name="eyeDiseaseStatus" value="白内障" title="白内障">
                                    <input type="checkbox" name="eyeDiseaseStatus" value="其他" title="其他">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他眼部疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="eyeDiseaseStatusOther" placeholder="请输入其他眼部疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">神经系统疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <select name="nervousDiseaseStatus" class="layui-input">
                                        <option value="">请选择</option>
                                        <option value="未发现">未发现</option>
                                        <option value="有">有</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">有神经系统疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="nervousDiseaseYes" placeholder="请输入有神经系统疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">其他系统疾病<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <select name="otherDiseaseStatus" class="layui-input">
                                        <option value="">请选择</option>
                                        <option value="未发现">未发现</option>
                                        <option value="有">有</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">有其他系统疾病说明<span class="ui-request">*</span></label>
                                <div class="layui-input-block">
                                    <input type="text" name="otherDiseaseYes" placeholder="请输入有其他系统疾病说明" class="layui-input"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="submit" value="保存" class="layui-btn" />
				</div>
			</div>
		</form>
        <#else>
            请先保存老人健康基本信息!
        </#if>
    </div>
</body>
<script src="${params.contextPath}/static/plug/layui/layui.all.js"></script>
<script>
    $(function () {
        var form = layui.form;
        form.render();
    })
</script>
</html>
